package com.zhentao.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;

/**
 * 入库管理表：记录数据入库状态、校验结果
 * @TableName data_storage
 */
@TableName(value ="data_storage")
@Data
public class DataStorage implements Serializable {
    /**
     * 入库记录ID
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 关联采集主表ID
     */
    private Integer collectionId;

    /**
     * 入库时间
     */
    private Date storageTime;

    /**
     * 标识码校验：1-通过 2-未通过
     */
    private Integer identifierCheck;

    /**
     * 数据版本（处理异常时用）
     */
    private Integer version;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        DataStorage other = (DataStorage) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getCollectionId() == null ? other.getCollectionId() == null : this.getCollectionId().equals(other.getCollectionId()))
            && (this.getStorageTime() == null ? other.getStorageTime() == null : this.getStorageTime().equals(other.getStorageTime()))
            && (this.getIdentifierCheck() == null ? other.getIdentifierCheck() == null : this.getIdentifierCheck().equals(other.getIdentifierCheck()))
            && (this.getVersion() == null ? other.getVersion() == null : this.getVersion().equals(other.getVersion()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getCollectionId() == null) ? 0 : getCollectionId().hashCode());
        result = prime * result + ((getStorageTime() == null) ? 0 : getStorageTime().hashCode());
        result = prime * result + ((getIdentifierCheck() == null) ? 0 : getIdentifierCheck().hashCode());
        result = prime * result + ((getVersion() == null) ? 0 : getVersion().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", collectionId=").append(collectionId);
        sb.append(", storageTime=").append(storageTime);
        sb.append(", identifierCheck=").append(identifierCheck);
        sb.append(", version=").append(version);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}